import java.util.ArrayList;

public class array{
    public static void main(String[] args) {
        ArrayList<Student> array = new ArrayList<>();
        Student stu1 = new Student("笑话",18);
        Student stu2 = new Student("笑话",11);
        Student stu3 = new Student("笑话",1);
        array.add(stu1);
        array.add(stu2);
        array.add(stu3);

        ArrayList<Student> newlist=getlist(array);
        for (int i = 0; i < newlist.size(); i++) {
            Student stu=newlist.get(i);
            System.out.println(stu.getName()+"..."+stu.getAge());
        }
    }

    public static ArrayList<Student> getlist (ArrayList<Student> list){
        ArrayList<Student> newlist = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            Student stu=list.get(i);
            int age = stu.getAge();
            if (age<18){
                newlist.add(stu);
            }
        }

        return newlist;
    }
}